<%@page import="com.mconnect.msurvey.model.SurveyPlan"%>
<%@page import="com.mconnect.msurvey.controller.PlanManager"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="com.mconnect.msurvey.controller.UserManager"%>
<%@page import="com.mconnect.msurvey.model.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="s" uri="/struts-tags"%>
     
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Panel Admina</title>
  <link rel="stylesheet" href="resources/css/ap.css">
  <link rel="stylesheet" href="js/jQuery/themes/base/jquery.ui.all.css">
  <link rel="stylesheet" href="js/jQuery/demos.css">
  <link rel="stylesheet" href="resources/css/detail_style.css">
  <link rel="stylesheet" type="text/css" href="resources/css/search_grid_style.css" />
  
	<script src="js/jQuery/jquery-1.8.2.js"></script>
	<script src="js/jQuery/ui/jquery.ui.core.js"></script>
	<script src="js/jQuery/ui/jquery.ui.widget.js"></script>
	<script src="js/jQuery/ui/jquery.ui.tabs.js"></script>
	<script src="js/jQuery/ui/jquery.ui.accordion.js"></script>
	
	<style>
		div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
		th#jaca { border: 1px solid #eee; padding: .6em 10px; text-align: left; text-align: center; height: 30px;}
		td#jaca { border: 1px solid #eee; padding: .2em 2px; text-align: left; text-align: center; height: 30px;}
		input{
			width: 130px;
		}
		input#brand{
			width: 20px;
		}
		td#label{
			width: 150px;
			margin-left: 10px;
			height: 30px;
			text-align: left;
		}
		td#cont{
			width: 150px;
		}
		

	</style>
  
  </head>
<script>
	$(function() {
		$( "#tabs" ).tabs({
			beforeLoad: function( event, ui ) {
				ui.jqXHR.error(function() {
					ui.panel.html(
						"Niestety, ale nie udało się załadować tej strony. " +
						"Spróbuj ponownie." );
				});
			}
		});
		$('.ui-tabs-search .search-adv-button').click(function(){$('#search-adv-form1').toggle();});
		$('#advance-search').click(function(){$('#search-adv-form2').toggle();});
		$('#technical-search').click(function(){$('#search-adv-form3').toggle();});
		$('#choosePlanSurvey').click(function(){
				var id_plan = $( "#id_plan" ).val();
				var firstname = $( "#s_firstname" ).val();
				var lastname = $( "#s_lastname" ).val();
				var mail = $( "#s_mail" ).val();
				var status = $( "#s_status" ).val();
				var phone = $( "#s_phone" ).val();
				var type = $( "#s_type" ).val();
				var region = $( "#region" ).val();
				var question1 = $( "#question1" ).val();
				var question2 = $( "#question2" ).val();
				var question3 = $( "#question3" ).val();
				var question4 = $( "#question4" ).val();
				var question5 = $( "#question5" ).val();
				var question6 = $( "#question6" ).val();
				var direction = $( "#direction" ).val();
				var experience = $( "#experience" ).val();
				var callCenter = 'NIE';
				var it = 'NIE';
				var telecomunication = 'NIE';
				var publicRelation = 'NIE';
				var sale = 'NIE';
				var java = 'NIE';
				var php = 'NIE';
				var javaScript = 'NIE';
				var bd_sql = 'NIE';
				var ce_plus = 'NIE';
				var python = 'NIE';
				var other = $( "#langOther" ).val();
				var ce_sharp = 'NIE';
				if($('#callCenter').is(':checked'))	callCenter = 'TAK';
				if($('#it').is(':checked'))it = 'TAK';
				if($('#telecommunication').is(':checked')) telecomunication = 'TAK';
				if($('#publicRelations').is(':checked')) publicRelation = 'TAK';
				if($('#sale').is(':checked')) sale = 'TAK';
				if($('#java').is(':checked')) java = 'TAK';
				if($('#php').is(':checked'))php = 'TAK';
				if($('#javaScript').is(':checked')) javaScript = 'TAK';
				if($('#bd_sql').is(':checked')) bd_sql = 'TAK';
				if($('#ce_plus').is(':checked')) ce_plus = 'TAK';
				if($('#python').is(':checked')) python = 'TAK';
				if($('#other').is(':checked')) other = 'TAK';
				if($('#ce_sharp').is(':checked')) ce_sharp = 'TAK';
				
				$.post(
						'searching/showSurveysContent.jsp',
						{
							id_plan: id_plan, firstname: firstname, lastname: lastname, mail : mail,
							status: status, phone : phone, type: type, region : region,
							question1 : question1, question2: question2, question3 : question3, question4 : question4, question5: question5, question6 : question6,
							callCenter : callCenter, it : it, telecommunication : telecomunication, publicRelations : publicRelation, sale : sale,
							direction : direction, experience : experience, java : java, php : php, javaScript : javaScript, bd_sql : bd_sql, ce_plus : ce_plus, python : python, 
							other : other, ce_sharp : ce_sharp
						},
						function (content) {
							$('#contents').html(content);
							return false;
						}
					);
			});
	});
</script>
<body>
<div id="top">
   
    <div class="sessionUser">
    	<div id="logoMconnect">
    		<img src="resources/images/top_logo.gif" width="84" height="59" alt="image001"/>
    	</div>
    	<div id="mConnect_txt">
        	mConnect<br/>al. Jana Pawła II 41c<br/>31-864 Kraków
       </div>
    	
	     <% User admin = (User)session.getAttribute("admin"); 
			if(admin == null){ %>
				<jsp:forward page="loginAdminForm.jsp"></jsp:forward>
		<%}%>
    </div>
    <img src="resources/images/kreska.png" class="kreska">
    <div class="header_txt">
      <a href="adminPanel.jsp" style="text-decoration: none;">
     		<p class="header_txt_1">mSurvey</p>
      		<p class="header_txt_2">Panel Administratora</p>
      	</a>
    </div>
    <ul id=menu>
      
    <li><s:a action="goToSearchSurvey">+Wyszukaj ankietę+</s:a></li>
	<li><s:a action="goToCampaigns">Kampanie</s:a></li>
	<li><s:a action="goToRegisterUser">Dodaj ankietera</s:a></li>
	<li><s:a action="goToConfirmList">Potwierdziły przybycie</s:a></li>
	<li><s:a action="goToReports">Raporty</s:a></li>
	<li style="float: right"><s:a action="logoutAdmin">Wyloguj</s:a></li>
    </ul>
    
    <div id=kategorie>
    	<div style="float: left; width: 96%; margin-left: 2%;">
		<div id="tabs">
			<ul>
				<li><a href="#tabs-1">Ankiety według planu</a></li>
				<li><a href="searching/showRecommend.jsp">Polecone osoby</a></li>
			</ul>
			<div id="tabs-1">
			<center>
				
			<div id="content1" style=" margin-top: 30px; margin-bottom: 30px;  font-size: 12px;">
			<% PlanManager pM = new PlanManager();
				List<SurveyPlan> planList = new ArrayList<SurveyPlan>();
				planList = pM.getPlanList();
			%>
			<div id="page" class="ui-tabs ui-widget" style="width: 850px;">
				<ul class="ui-tabs-nav ui-tabs-search">
					<li style="border: 0; width: 200px; margin-left: 50px; text-align: center;"><h3>Wyszukiwanie ankiet</h3></li>
					<li class="search-bottom">
						<span class="fll hint note request-time" style="margin-top: 9px;">Kampania</span>
						<a href="#" class="search-adv-button fll"><span class="ui-icon ui-icon-carat-1-s"></span></a>
						<select id="id_plan" name="id_plan"  style="float:left; margin-top: 7px; width:200px;">
						<option value="0">Wszystkie</option>
						<% for(SurveyPlan plan : planList){ %> 
									<option value="<%=plan.getId_plan() %>"><%= plan.getPlanName() %></option>
								<%} %>	
						</select>
						<a href="#" id="choosePlanSurvey" class="search-button fll"><span class="ui-icon ui-icon-search"></span></a>
					</li>
				</ul>
				<div class="clear"></div>
				<div id="search-adv-form1" class="form search-form" style="display:none">
					<div class="wide">

						<table style="width: 810px;">
							<tr>
								<td style="width: 270px;">
									<label class="note" style="margin-top:3px;">Imie</label> 
									<input type="text"  id="s_firstname">
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Nazwisko</label>
									<input type="text"  id="s_lastname">
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Telefon</label>
									<input type="text"  id="s_phone">
								</td>
							</tr>
							<tr>
								<td>
									<label class="note" style="margin-top:3px;">Mail</label>
									<input type="text" id="s_mail">
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Status</label>
									<select style="width: 135px;" id="s_status">
										<option value="NIE">Nie zatwierdzony</option>
										<option value="TAK">Zatwierdzony</option>
										<option value="all">Wszystkie</option>
									</select>
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Kto</label>
									<select style="width: 135px;" id="region">
										<option value="all">Wszystkie</option>
										<option value="responder">Ankieter</option>
										<option value="HR">Dział HR</option>
									</select>
								</td>
							</tr>
							<tr>
								<td><a href="#" style="margin-left: 15px; margin-top: 10px;" class="search-adv-button fll" id="technical-search" >Filtry techniczne</a></td>
								<td >
									<a href="#" style="margin-left: 15px; margin-top: 10px;" class="search-adv-button fll" id="advance-search" >Filtry standardowe</a>
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Typ ankiety</label>
									<select style="width: 135px;" id="s_type">
										<option value="all">Wszystkie</option>
										<option value="technical">Techniczna</option>
										<option value="typical">Standardowa</option>
									</select>
								</td>
							</tr>
						</table>
					</div>
				</div>
				<div id="search-adv-form2" class="form search-form" style="display:none">
					<div class="wide">
						
						<table style="width: 810px;">
							<tr>
								<td rowspan="2" style="width: 235px;" scope="row">
									<div style="overflow:auto; width: 220px; max-height: 100px; ">
									<label class="note" style="margin-top:3px;">Branża</label>
										<table>
								           	<tr>
								           		<td width="20px" align="left"><input type="checkbox" id="callCenter"  style="width: 20px;" /></td>
								               	<td >Call Center</td>
								           	</tr>
								            <tr>
								              	<td width="20px" align="left"><input type="checkbox" id="it" style="width: 20px;" /></td>
								             	<td>IT</td>
								         	</tr>
								           	<tr>
								             	<td width="20px" align="left"><input type="checkbox" id="telecommunication" style="width: 20px;"/></td>
								                <td>Telekomunikacja</td>
								        	</tr>
								            <tr>
								                <td width="20px" align="left"><input type="checkbox" id="publicRelations" style="width: 20px;" /></td>
								              	<td>Public Relations</td>
								            </tr>
								            <tr>
								                <td width="40px" align="left"><input type="checkbox" id="sale" style="width: 20px;" /></td>
								                <td>Sprzedaż</td>
								            </tr>
								         </table>
									</div>
								</td>
								<td style="width: 130px;" scope="row">
									<label class="note" style="margin-top:3px;">Wiek kandydata</label> 
									<select id="question1" style="width: 120px;">
										<option value="all">Wszyscy</option>
										<option value="18-20">18-20 lat</option>
										<option value="21-23">21-23 lat</option>
										<option value="24-26">24-26 lat</option>
										<option value="26">powyżej 26 lat</option>
									</select>
								</td>
								<td style="width: 190px;">
									<label class="note" style="margin-top:3px;">Typ studiów</label> 
									<select id="question2" style="width: 140px;">
										<option value="all">Wszystkie</option>
										<option value="Dziennie">Dzienne</option>
										<option value="Zaocznie">Zaoczne</option>
										<option value="Nie studiuję">Nie uczący się</option>
									</select>
								</td>
								<td style="width: 255px;">
									<label class="note" style="margin-top:3px;">Uczelnia</label>
									<select id="question6" style="width: 180px;">
										<option value="all">Wszystkie</option>
										<option value="AGH">AGH</option>
										<option value="Politechnika Krakowska">Politechnika Krakowska</option>
										<option value="Uniwersytet Jagieloński">Uniwersytet Jagieloński</option>
										<option value="Uniwersytet Rolniczy">Uniwersytet Rolniczy</option>
										<option value="Uniwersytet Ekonomiczny">Uniwersytet Ekonomiczny</option>
										<option value="Krakowska Akademia">Krakowska Akademia</option>
										<option value="other">Inna</option>
									</select>
								</td>
								
							</tr>
							<tr>
								<td>
									<label class="note" style="margin-top:3px;">Osoba pracująca</label>
									<select id="question3" style="width: 120px;">
										<option value="all">Wszyscy</option>
										<option value="TAK">TAK</option>
										<option value="NIE">NIE</option>
									</select>
								</td>
								<td >
										<label class="note" style="margin-top:3px; ">Zmiana branży</label> 
										<select id="question4" style="width: 140px;" title="Myśląca o zmianie branży?">
											<option value="all">Wszyscy</option>
											<option value="TAK">TAK</option>
											<option value="NIE">NIE</option>
										</select>
								</td>
								<td>
										<label class="note" style="margin-top:3px;">Dyspozycyjność</label>
										<select id="question5" title="Gotowość do podjęcia pracy?" style="width: 180px;">
											<option value="all">Wszystkie</option>
											<option value="W ciągu najbliższych 7dni">W ciągu 7dni</option>
											<option value="Do miesiąca">Do miesiąca</option>
											<option value="Powyżej miesiąca">Powyżej miesiąca</option>
										</select>
								</td>
							</tr>
							
						</table>
				<div class="clear"></div>
				<div class="search-label"></div>
				<div class="clear"></div>
				<div id="paging_container" class="container">
				<div id="reload" class="ui-overlay" style="display: none;"><div class="ui-widget-overlay"></div></div>
					
					<div class="clear"> </div>
					<div class="info_text hint note fll"> </div>
					<div class="page_navigation frr"> </div>
				</div>
				<div class="clear"></div>
			</div><!-- page -->
				
				</div>
				<div id="search-adv-form3" class="form search-form" style="display:none">
					<div class="wide">
						
						<table style="width: 810px;">
							<tr>
								<td rowspan="2" style="width: 300px;" scope="row">
									<div style="overflow:auto; width: 270px; max-height: 100px; ">
									<label class="note" style="margin-top:3px; width: 100%; text-align:center;">Języki programowania</label>
										<table>
								           <tr>
								           		<td width="40px" align="left"><input id="java" type="checkbox" value="TAK" style="width: 20px;" /></td>
								               	<td >JAVA</td>
								           	</tr>
								            <tr>
								                <td width="40px" align="left"><input id="ce_sharp" type="checkbox"  value="TAK" style="width: 20px;" /></td>
								              	<td>C#</td>
								            </tr>
								            <tr>
								                <td width="40px" align="left"><input id="ce_plus" type="checkbox" value="TAK" style="width: 20px;" /></td>
								              	<td>C / C++</td>
								            </tr>
								            <tr>
								             	<td width="40px" align="left"><input id="php" type="checkbox" value="TAK" style="width: 20px;" /></td>
								                <td>PHP</td>
								        	</tr>
								            <tr>
								                <td width="40px" align="left"><input id="bd_sql" type="checkbox" value="TAK" style="width: 20px;" /></td>
								                <td>SQL</td>
								            </tr>
								            <tr>
								                <td width="40px" align="left"><input id="javaScript" type="checkbox" value="TAK" style="width: 20px;" /></td>
								                <td>JavaScript</td>
								            </tr>
								             <tr>
								                <td width="40px" align="left"><input id="python" type="checkbox" value="TAK" style="width: 20px;" /></td>
								                <td>Python</td>
								            </tr>
								             <tr>
								                <td width="40px" align="left"><input id="p5check5" type="checkbox" onclick="document.getElementById('langOther').disabled = !this.checked" style="width: 20px;" /></td>
								                <td>Inne &nbsp <input type="text" id="langOther" name="language.other" disabled="disabled" /><br/></td>
								            </tr>
								         </table>
									</div>
								</td>
								<td style="width: 255px;" scope="row">
									<label class="note" style="margin-top:3px;">Kierunek studiów</label> 
									<select id="direction" style="width: 180px;">
										<option value="all">Wszyscy</option>
										<option value="Informatyka">Informatyka</option>
										<option value="Teleinformatyka">Teleinformatyka</option>
										<option value="Elektronika">Elektronika</option>
										<option value="Elektrotechnika">Elektrotechnika</option>
										<option value="Automatyka i Robotyka">Automatyka i Robotyka</option>
										<option value="Matematyka">Matematyka</option>
										<option value="Fizyka">Fizyka</option>
									</select>
								</td>
								<td style="width: 255px;">
									<label class="note" style="margin-top:3px;">Doświadczenie IT</label> 
									<select id="experience" style="width: 190px;">
										<option value="all">Wszystkie</option>
										<option value="mniej niż rok">mniej niż rok</option>
										<option value="rok">rok</option>
										<option value="powyżej jednego roku">powyżej jednego roku</option>
										<option value="tylko praktyki studenckie">tylko praktyki studenckie</option>
										<option value="nie posiadam doświadczenia">nie posiadam doświadczenia</option>
									</select>
								</td>
							</tr>
							
						</table>
				<div class="clear"></div>
				<div class="search-label"></div>
				<div class="clear"></div>
				<div id="paging_container" class="container">
				<div id="reload" class="ui-overlay" style="display: none;"><div class="ui-widget-overlay"></div></div>
					
					<div class="clear"> </div>
					<div class="info_text hint note fll"> </div>
					<div class="page_navigation frr"> </div>
				</div>
				<div class="clear"></div>
				</div>
				
				</div>
				</div></div>
				
				<div id="contents" style="width: 900px;">
				
				</div>
		</center>
			</div>
			
		</div>
   		</div>
	</div>	 
</div>
</body>
</html>